define(function() {
    var fnHandle = function () {}
    var onLoadedHandle = function () {
        document.removeEventListener('DOMContentLoaded', onLoadedHandle)
        fnHandle()
    }

    function callOnLoaded (fn) {
        fnHandle = fn
        if (document.readyState === 'complete' || document.readyState !== 'loading') {
            onLoadedHandle()
        } else {
            document.addEventListener('DOMContentLoaded', onLoadedHandle)
        }
    }

    return {
        callOnLoaded: callOnLoaded
    };
});